from aestate.dbs._mysql import tag
from aestate.work.Annotation import Table

from sotd import table_template


@Table(name='email_recipient', msg='邮件接收者')
class EmailRecipient(table_template):
    """邮件接收者"""

    def __init__(self, **kwargs):
        self.is_delete = tag.tinyintField(default=0)
        self.name = tag.textField(length=255, comment='邮件接收人')
        self.from_email = tag.intField(comment='邮件发送人')
        super(EmailRecipient, self).__init__(**kwargs)


@Table(name='email_sender', msg='邮件发送者')
class EmailSender(table_template):
    """邮件发送者"""

    def __init__(self, **kwargs):
        self.is_delete = tag.tinyintField(default=0)
        self.from_email = tag.textField(comment="谁发的邮件")
        self.title = tag.textField(comment="标题名称")
        self.message = tag.textField(comment='标题旁边的描述')
        self.content = tag.textField(comment='发送的内容')
        super(EmailSender, self).__init__(**kwargs)


@Table(name='view_record', msg='访问记录')
class ViewRecord(table_template):

    def __init__(self, **kwargs):
        self.is_delete = tag.tinyintField(default=0)
        self.path_info = tag.textField(is_null=True)
        self.remote_addr = tag.textField(is_null=True)
        self.http_host = tag.textField(is_null=True)
        self.http_sec_ch_ua = tag.textField(is_null=True)
        self.http_user_agent = tag.textField(is_null=True)
        self.http_sec_ch_ua_platform = tag.textField(is_null=True)
        self.http_origin = tag.textField(is_null=True)
        self.http_referer = tag.textField(is_null=True)
        self.username = tag.textField(is_null=True)
        super(ViewRecord, self).__init__(**kwargs)
